Attribute VB_Name = "Module9"
'Lastly call it like this:

'   DosPathName = GetDosPath(Long Path Goes in here)

'*******************************************************
'Joe Markowski
'jsmarko@eclipse.net
'
'Here's a code snippet to retrieve the old dos filenames
'from the Win95 or Win98 Long filenames.  Occasionally,
'you may need this function.
'For example:
'  C:\MyLongestPath\MyLongerPath\MyFilename.txt
'would return as
'  C:\Mylong~1\MyLong~2\Myfile~1.txt
'*******************************************************

'Put the declaration in a .bas module

Declare Function GetShortPathName Lib "kernel32" Alias _
"GetShortPathNameA" (ByVal lpszLongPath As String, _
ByVal lpszShortPath As String, ByVal cchBuffer As Long) As Long

'Next comes the function (Place in a module):

Public Function GetDosPath(LongPath As String) As String

Dim s As String
Dim i As Long
Dim PathLength As Long

        i = Len(LongPath) + 1

        s = String(i, 0)

        PathLength = GetShortPathName(LongPath, s, i)

        GetDosPath = Left$(s, PathLength)

End Function



